package org.jeecg.modules.geek.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

/**
 * @Description: 资源表
 * @Author: jeecg-boot
 * @Date:   2025-08-26
 * @Version: V1.0
 */
@Data
@TableName("db_resource")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@Schema(description="资源表")
public class DbResource implements Serializable {
    private static final long serialVersionUID = 1L;

	/**主键*/
	@TableId(type = IdType.ASSIGN_ID)
    @Schema(description = "主键")
    private String id;
	/**缩略图*/
	@Excel(name = "缩略图", width = 15)
    @Schema(description = "缩略图")
    private String thumbnail;
	/**所属分类*/
	@Excel(name = "所属分类", width = 15, dictTable = "db_classify", dicCode = "id", dicText = "title")
	@Dict(dictTable = "db_classify", dicCode = "id", dicText = "title")
    @Schema(description = "所属分类")
    private String classifyId;
	/**资源标题*/
	@Excel(name = "资源标题", width = 15)
    @Schema(description = "资源标题")
    private String title;
	/**资源链接*/
	@Excel(name = "资源链接", width = 15)
    @Schema(description = "资源链接")
    private String link;
	/**排序*/
	@Excel(name = "排序", width = 15)
    @Schema(description = "排序")
    private String sort;
	/**描述*/
	@Excel(name = "描述", width = 15)
    @Schema(description = "描述")
    private String description;
	/**富文本*/
	@Excel(name = "富文本", width = 15)
    @Schema(description = "富文本")
    private String richText;
	/**点击量*/
	@Excel(name = "点击量", width = 15)
    @Schema(description = "点击量")
    private String clickNumber;
	/**创建人*/
    @Schema(description = "创建人")
    private String createBy;
	/**创建日期*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @Schema(description = "创建日期")
    private Date createTime;
	/**更新人*/
    @Schema(description = "更新人")
    private String updateBy;
	/**更新日期*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @Schema(description = "更新日期")
    private Date updateTime;

    public void setClickCount(Integer newClickCount) {
        this.clickNumber = String.valueOf(newClickCount);
    }
}
